//
//  UIViewController+presentStyle.m
//  LeTTPhoneClient
//
//  Created by CaiLei on 2/26/14.
//  Copyright (c) 2014 Le123. All rights reserved.
//

#import "UIViewController+presentStyle.h"

@implementation UIViewController (presentStyle)

- (void)presentFromRight:(UIViewController *)aVC {
    CATransition *transition = [CATransition animation];
    transition.duration = 0.3;
    transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
    transition.type = kCATransitionPush;
    transition.subtype = kCATransitionFromRight;
    [self.view.window.layer addAnimation:transition forKey:nil];
    
    [self presentViewController:aVC animated:NO completion:^{
        
    }];
}

- (void)dismissFromRight {
    [self dismissViewControllerAnimated:NO completion:^{
        CATransition *transition = [CATransition animation];
        transition.duration = 0.5;
        transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
        transition.type = kCATransitionPush;
        transition.subtype = kCATransitionFromLeft;
        [self.view.window.layer addAnimation:transition forKey:nil];

    }];
}

- (void)alertWithMsg:(NSString *)msg {
    UIAlertView *av = [[UIAlertView alloc] initWithTitle:@"" message:msg delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
    [av show];
}
@end
